package com.panshi.controller;

import com.panshi.api.MemberApi;
import com.panshi.vo.R;
import com.panshi.vo.SearchVO;
import com.panshi.vo.StatusVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/member")
public class MemberController {

    @Autowired
    private MemberApi memberApi;

    @GetMapping("/pageMemberList")
    public Map<String,Object> pageMemberList(Integer page, Integer limit){
        SearchVO searchVO = new SearchVO();
        searchVO.setCurrentPage(page);
        searchVO.setPageSize(limit);
        R r = memberApi.pageMemberList(searchVO);
        System.out.println(r.getData());
        return r.getData();
    }

    @PutMapping
    public R editMemberStatus(@RequestBody StatusVO statusVO){
        return memberApi.editMemberStatus(statusVO);
    }
}
